package com.qcby.onlinelearningplatform.Service.Impl;

import com.qcby.onlinelearningplatform.Dao.TeacherDao;
import com.qcby.onlinelearningplatform.Entity.*;
import com.qcby.onlinelearningplatform.Service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    public TeacherDao teacherDao;

    @Override
    public List<TeacherChannel> teacherChannle() {
        return this.teacherDao.teacherChannel();
    }

    @Override
    public List<Teacher> teacherState(Integer pageSize,Integer pageIndex) {
        pageIndex = pageSize * (pageIndex - 1);
        return this.teacherDao.teacherState(pageSize,pageIndex);
    }

    @Override
    public List<Student> studentInfo(Integer pageSize, Integer pageIndex) {
        pageIndex = pageSize * (pageIndex - 1);
        return this.teacherDao.studentInfo(pageSize,pageIndex);
    }

    @Override
    public List<Teacher> studentFindTeacher(Integer pageSize,Integer pageIndex) {
        pageIndex = pageSize * (pageIndex - 1);
        return this.teacherDao.studentFindTeacher(pageSize,pageIndex);
    }

    @Override
    public List<Student> findNameSno(Student student) {
        Student studet1 =new Student();
        studet1.setS_name(student.getS_name());
        studet1.setS_sno(student.getS_sno());
return this.teacherDao.findNameSno(studet1);

    }

    @Override
    public int updateStudent(Student student) {
        return this.teacherDao.updateStudent(student);
    }

    @Override
    public List<StuHomework> showHomework(Integer id) {
        return this.teacherDao.showHomework(id);
    }

    @Override
    public int insertHomework(HomeWork homeWork) {
        return this.teacherDao.insertHomework(homeWork);
    }
}
